﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Http.Description;
using FANUC.DTO;
using FANUC.BLL;
using System.Web.Http;

namespace FANUC.Controllers
{
    public class Alarm_HistoryController : ApiController
    {
        private TraceService service = new TraceService();

        // GET: Alarm_History
        [ResponseType(typeof(AlarmHistoryDtoOut))]
        public IHttpActionResult Get(string partSerial, int hours = 4)
        {
            var data = service.GetRelativeAlarmHistoryByPartSerial(partSerial, hours);
            return Ok(data);
        }

        [ResponseType(typeof(AlarmHistoryDtoOut))]
        public IHttpActionResult Post(AlarmSearchDtoIn input)
        {
            var data = service.GetAlarmsHistory(input);
            return Ok(data);
        }

        [ApiExplorerSettings(IgnoreApi = true)]
        public string Options()
        {
            return null;
        }
        protected override void Dispose(bool disposing)
        {
            if (disposing)
            {
                service.Dispose();
            }
            base.Dispose(disposing);
        }
    }
}